I will analyze meteor landings throughout the world and take my first steps towards my goal of using astronomy and computer science to explore the mysteries of the universe!

The data for this project comes from NASA's open data portal - Nasa Meteorite Landings. This is an amazing treasure trove of information for space buffs directly from NASA.

In order to map these sites of meteor landings in Python, I will use the Folium module. Folium is a popular python library used to visualize geospatial data and create interactive maps.

First, lets load the Python modules that will be needed for this project. These include Pandas, Folium, Matplotlib, Math and Geopandas.

In [5]:
from folium.plugins import MarkerCluster
import pandas as pd
import folium
import matplotlib.pyplot as plt
import math
import geopandas

Download the Meteorite Landings csv file from this link -> Nasa Meteorite Landings

The next step is to read the csv file and see its structure. (Adjust the path name according to where you have downloaded the csv)

In [6]:
meteors_raw_data = pd.read_csv("../data/Meteorite_Landings.csv")
meteors_raw_data.head()
Out[6]:
name id nametype recclass mass (g) fall year reclat reclong GeoLocation
0 Aachen 1 Valid L5 21.0 Fell 01/01/1880 12:00:00 AM 50.77500 6.08333 (50.775, 6.08333)
1 Aarhus 2 Valid H6 720.0 Fell 01/01/1951 12:00:00 AM 56.18333 10.23333 (56.18333, 10.23333)
2 Abee 6 Valid EH4 107000.0 Fell 01/01/1952 12:00:00 AM 54.21667 -113.00000 (54.21667, -113.0)
3 Acapulco 10 Valid Acapulcoite 1914.0 Fell 01/01/1976 12:00:00 AM 16.88333 -99.90000 (16.88333, -99.9)
4 Achiras 370 Valid L6 780.0 Fell 01/01/1902 12:00:00 AM -33.16667 -64.95000 (-33.16667, -64.95)

This dataset contains the meteor name, mass, year and geographic coordinates. Let's clean up the data and plot it on a map using their latitudes and longitudes.

The rows containg null or missing values for latitude and longitude are dropped and the result is plotted on a map.

As there are over 47,000 meteor landing points, plotting them together wil cause clutter on the map. So, I use a feature of Folium to cluster the points based on geography. Upon clicking the cluster, we can zoom in and view the meteor details individually. To see how to plot all the points without clustering, go to the bottom of the page.

In [7]:
meteors = meteors_raw_data.dropna(subset=["reclong", "reclat"]).drop_duplicates(subset=["reclong", "reclat"])
map = folium.Map(tiles='cartodbpositron', zoom_start=30)
marker_cluster = MarkerCluster().add_to(map)

for index, row in meteors.iterrows():
    name = row["name"]
    year = str(row["year"])
    latitude = row['reclat']
    longitude = row['reclong']

    popup_text = '<h3 style="color:green;">' + name + '</h3>'
    if year.lower() != "nan":
        popup_text = popup_text + year
    
    folium.Marker(location = [latitude, longitude], tooltip = popup_text).add_to(marker_cluster)
map
Out[7]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Now, lets plot a heat map also known as a Choropleth map to see the distribution of meteors across the world. To do so, I need a geojson file which contains the polygons(shapes) of all the world's countries. I got this dataset from an open community - Natural Earth: geo-countries

Next I need to know the countries where the meteors fell so that I can get their count to plot their distribution. To do so, I used Nominatim which is a search engine for OpenStreetMap data. I used calls to this service to perform a reverse geo-coding to find out the countries of origin.

Run the code below at your own risk! As there are more than 45,700 meteors in the data set, plotting them all together results in a cluttered and unreadable map.Also, Folium being a wrapper in python for Leaflet.js is unable to process a huge dataset and plot it dynamically.

In [8]:
# map = folium.Map(tiles='cartodbpositron', zoom_start=30)

# for index, row in meteors.iterrows():
#     name = row["name"]
#     year = str(row["year"])
#     latitude = row['reclat']
#     longitude = row['reclong']

#     popup_text = '<h3 style="color:green;">' + name + '</h3>'
#     if year.lower() != "nan":
#         popup_text = popup_text + year
    
#     folium.Marker(location = [latitude, longitude], tooltip = popup_text).add_to(map)
# map
In [ ]: